package com.fit.lov.course;

import org.apache.tapestry5.ValueEncoder;
import org.hibernate.Session;

import com.fit.entities.course.Course;

public class CourseEncoder implements ValueEncoder {
	private Session session;

	public CourseEncoder(Session session) {
		this.session = session;
	}

	public String toClient(Object arg0) {
		return ((Course)arg0).getCourseId().toString();
	}

	public Object toValue(String arg0) {
		return session.load(Course.class, new Long(arg0));
	}
}
